from pydantic import BaseModel, Field
from datetime import datetime
from typing import List, Optional


class KnowledgeBaseCreateRequest(BaseModel):
    name: str = Field(..., description="知识库名称", min_length=1, max_length=255)
    description: Optional[str] = Field(None, description="知识库描述")
    embedding_model_name: Optional[str] = Field(None, description="默认嵌入模型名称")


class KnowledgeBaseUpdateRequest(BaseModel):
    name: Optional[str] = Field(None, description="知识库名称", min_length=1, max_length=255)
    description: Optional[str] = Field(None, description="知识库描述")
    embedding_model_name: Optional[str] = Field(None, description="默认嵌入模型名称")


class KnowledgeBaseResponse(BaseModel):
    id: int
    name: str
    description: Optional[str]
    embedding_model_name: Optional[str] = None
    created_at: datetime
    updated_at: datetime
    document_count: int = 0


class KnowledgeBaseListResponse(BaseModel):
    success: bool
    knowledge_bases: List[KnowledgeBaseResponse]
    total_count: int
    page: int
    page_size: int
    total_pages: int


